class Solution {
public:
    int maxChunksToSorted(vector<int>& arr) {
        int res=0;
        int max_num=0;
        for(int i=0;i<arr.size();i++){
            max_num=max(max_num,arr[i]);
            if(max_num==i){
                res++;
            }
        }
        return res;
    }
};